package com.itheima.d4_Api_Object;

import java.util.Objects;

public class student {//extends Object
    private String name;
    private int age;
    private char sex;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;//getClass获取对象的类型
        student student = (student) o;
        //Objects的equals方法更加安全，可以包含空值出现的情况
        return age == student.age && sex == student.sex && Objects.equals(name, student.name);
    }



    @Override
    public String toString() {
        return "student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                '}';
    }

    public  student(){

    }
    public student(String name, int age, char sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }
}
